var rootview = ui("$");
var do_App = sm("do_App");
var do_Page = sm("do_Page");
var nf = sm("do_Notification");
var segment4Interests=ui("segment4Interests");
var labelSex=ui("labelSex");
var layoutSex = ui("layoutSex");
var openHelper = require("helper/open");
//UI
var aLayoutRow=ui("aLayoutRow");

rootview.setMapping({   // 此处的Mapping只能设置在 RootView 上 ;
	"aLayout_top_line.visible":"showTopLine",
	"aLayoutRow.tag":"id",	
	"ImgUserPic.source" : "fullLogo",
	"lableNick.text" : "nick", 
	"labelSex.tag" : "sex",
	"segment4Interests.tag" : "interests",
	"lableOurCircle.tag" : "ourCircleCount",
	"segment4Interests.visible" : "isShowInterests",
});

var listdataInterests = mm("do_ListData");
segment4Interests.bindItems(listdataInterests);


rootview.on("dataRefreshed", function(){
	var ourCircleCount = ui("lableOurCircle").tag;
	if(ourCircleCount>0){
		ui("lableOurCircle").text = "同在"+ourCircleCount+"个圈子";
	}else{
		ui("lableOurCircle").text = "";
	}
	listdataInterests.removeAll();
	
	if(labelSex.tag==2){//女
		labelSex.text="♀";
		layoutSex.bgColor = "F883B8FF";
	}else{//男
		labelSex.text="♂";
		layoutSex.bgColor = "3EC8B1FF";
	}
	var interests = ui("segment4Interests").tag;//兴趣
	if(null!=interests&&""!=interests){
		var interestsList = interests.split(",");
		var jsonImgs = [];
		for (var i = 0; i < interestsList.length; i++) {
			jsonImgs.push({
				interest : interestsList[i]
			});
		}
		listdataInterests.addData(jsonImgs);
	}
	segment4Interests.refreshItems();
});


rootview.on("touch",function(){
	var userId = aLayoutRow.tag
	openHelper.openPersonal(userId);
})

